//
//  CardItemCell.m
//  KeTianDemo
//
//  Created by jay on 2020/8/24.
//  Copyright © 2020 jay. All rights reserved.
//

#import "CardItemCell.h"

@interface CardItemCell()

@end

@implementation CardItemCell

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        self.layer.cornerRadius = 15.0;
        self.layer.masksToBounds = YES;
    }
    
    return self;
}

-(UIView *)container {
    if (_container == nil) {
        _container = [UIView new];
        _container.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_container];
        
        [_container mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_equalTo(0);
        }];
    }
    return _container;
}

-(UIImageView *)picImageView {
    if (_picImageView == nil) {
        _picImageView = [UIImageView new];
        _picImageView.contentMode = UIViewContentModeScaleAspectFit;
        _picImageView.clipsToBounds = YES;
        [self.container addSubview:_picImageView];
        
        [_picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.mas_equalTo(0);
            make.bottom.mas_equalTo(self.titleLabel.mas_top).mas_equalTo(0);
        }];
    }
    return _picImageView;
}

-(UILabel *)titleLabel {
    if (_titleLabel == nil) {
        _titleLabel = [UILabel labelText:@"" font:TX_FONT(16) color:TX_COLOR_FROM_RGB(0x333333) align:NSTextAlignmentCenter lines:2];
        [self.container addSubview:_titleLabel];

        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(70);
            make.right.mas_equalTo(-70);
            make.height.mas_equalTo(80);
            make.bottom.mas_equalTo(0);
        }];
    }
    return _titleLabel;
}

@end
